package com.jy.modules.cims.component.balance.servicefee;

import java.math.BigDecimal;

import com.jy.modules.cims.common.CimsConstant;
import com.jy.modules.cims.data.common.dto.TCMmCostParamDTO;
import com.jy.modules.cims.data.common.dto.TCMmRaisePlanDTO;
import com.jy.modules.cims.data.dto.CreditDetailDto;
import com.jy.modules.cims.data.dto.LoanDetailDto;

public class BaseServiceFee implements ServiceFeeI{

	/**
	 * 债权-初始化费用计算**************************************************
	 * @author zhangmi
	 * @date 2016-8-16 上午10:49:50
	 * @see com.jy.modules.cims.component.balance.servicefee.ServiceFeeI#doServiceFee(com.jy.modules.cims.data.dto.CreditDetailDto, com.jy.modules.cims.data.common.dto.TCMmCostParamDTO)
	 */
	@Override
	public BigDecimal doServiceFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		return new BigDecimal(0);
	}

	@Override
	public BigDecimal doGuaranteeFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		return new BigDecimal(0);
	}

	@Override
	public BigDecimal doRiskFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		return new BigDecimal(0);
	}
	

	/**
	 * 贷款-初始化费用计算**************************************************
	 * @author zhangmi
	 * @date 2016-8-16 上午10:50:20
	 * @see com.jy.modules.cims.component.balance.servicefee.ServiceFeeI#doServiceFee(com.jy.modules.cims.data.dto.LoanDetailDto, com.jy.modules.cims.data.common.dto.TCMmCostParamDTO, com.jy.modules.cims.data.common.dto.TCMmRaisePlanDTO)
	 */
	@Override
	public BigDecimal doServiceFee(LoanDetailDto loanDetailDto,
			TCMmCostParamDTO tcmmCostParamDto, TCMmRaisePlanDTO tcmmRaisePlanDto) {
		return new BigDecimal(0);
	}

	@Override
	public BigDecimal doGuaranteeFee(LoanDetailDto loanDetailDto,
			TCMmCostParamDTO tcmmCostParamDto, TCMmRaisePlanDTO tcmmRaisePlanDto) {
		return new BigDecimal(0);
	}

	@Override
	public BigDecimal doRiskFee(LoanDetailDto loanDetailDto,
			TCMmCostParamDTO tcmmCostParamDto, TCMmRaisePlanDTO tcmmRaisePlanDto) {
		return new BigDecimal(0);
	}
	
	/**
	 * 
	 * @Description 根据服务类型获取 服务费计算基数
	 * @param creditDetailDto
	 * @param baseCode
	 * @return   
	 * BigDecimal  
	 * @throws
	 * @author zhangmi
	 * @date 2016-4-8
	 */
	public BigDecimal getBaseServiceFee(CreditDetailDto creditDetailDto,
			String baseCode){
		if(CimsConstant.BASE_SERVICEFEE_MYCREDIT.equals(baseCode)){ //我司债权价值
			return creditDetailDto.getThisCreditorValue();
		}else if(CimsConstant.BASE_SERVICEFEE_DFCREDIT.equals(baseCode)){ //对方债权价值
			return creditDetailDto.getMakeCreditorValue();
		}else if(CimsConstant.BASE_SERVICEFEE_CONTRACT.equals(baseCode)){ //合同金额
			return creditDetailDto.getContractSum();
		}
		return new BigDecimal(0);
	}
	/**
	 * 
	 * @Description 担保费基数获取
	 * @param creditDetailDto
	 * @param baseCode
	 * @return   
	 * BigDecimal  
	 * @throws
	 * @author zhangmi
	 * @date 2016-4-8
	 */
	public BigDecimal getBaseBondFee(CreditDetailDto creditDetailDto,
			String baseCode){
		if(CimsConstant.BASE_BONDFEE_THISCREDITVALUE.equals(baseCode)){//当前债权价值
			return creditDetailDto.getThisCreditorValue();
		}else if(CimsConstant.BASE_BONDFEE_SYBJ.equals(baseCode)){ //剩余本金
			return creditDetailDto.getMustAmount();
		}else if(CimsConstant.BASE_BONDFEE_SYBX.equals(baseCode)){ //剩余本息 = 剩余本金+剩余本息
			return creditDetailDto.getMustAmount().add(creditDetailDto.getMustAccrual());
		}
		return new BigDecimal(0);
	}
	
	/**
	 * 
	 * @Description 获取风险金计算基数
	 * @param creditDetailDto
	 * @param baseCode
	 * @return   
	 * BigDecimal  
	 * @throws
	 * @author zhangmi
	 * @date 2016-4-8
	 */
	public BigDecimal getBaseRiskFee(CreditDetailDto creditDetailDto,
			String baseCode){
		if(CimsConstant.BASE_RISKFEE_HT.equals(baseCode)){
			return creditDetailDto.getContractSum();
		}else if(CimsConstant.BASE_RISKFEE_FK.equals(baseCode)){//当前债权价值
			return creditDetailDto.getLoanSum();
		}else if(CimsConstant.BASE_RISKFEE_SYBJ.equals(baseCode)){ //剩余本金
			return creditDetailDto.getMustAmount();
		}else if(CimsConstant.BASE_RISKFEE_SYBX.equals(baseCode)){ //剩余本息 = 剩余本金+剩余本息
			return creditDetailDto.getMustAmount().add(creditDetailDto.getMustAccrual());
		}else if(CimsConstant.BASE_RISKFEE_JGCREDIT.equals(baseCode)){ //剩余本息 = 剩余本金+剩余本息
			return new BigDecimal(0);
		}
		return new BigDecimal(0);
	}
	
	/**
	 * 根据服务类型获取 服务费计算基数 --贷款
	 * @Title getBaseServiceFee
	 * @Description TODO
	 * @param creditDetailDto
	 * @param baseCode
	 * @return 
	 * BigDecimal 
	 * @author zhangmi
	 * @date 2016-8-16-下午2:17:20
	 * @update 
	 * @throws
	 */
	public BigDecimal getBaseServiceFee(LoanDetailDto LoanDetailDto,
			String baseCode){
		if(CimsConstant.BASE_SERVICEFEE_MYCREDIT.equals(baseCode)){ //放款金额
			return LoanDetailDto.getLoanAmount();
		}else if(CimsConstant.BASE_SERVICEFEE_DFCREDIT.equals(baseCode)){ //放款金额
			return LoanDetailDto.getLoanAmount();
		}else if(CimsConstant.BASE_SERVICEFEE_CONTRACT.equals(baseCode)){ //合同金额
			return LoanDetailDto.getContractAmount();
		}
		return new BigDecimal(0);
	}
	/**
	 * 根据服务类型获取 担保费计算基数 --贷款
	 * @Title getBaseBondFee
	 * @Description TODO
	 * @param LoanDetailDto
	 * @param baseCode
	 * @return 
	 * BigDecimal 
	 * @author zhangmi
	 * @date 2016-8-16-下午2:54:19
	 * @update 
	 * @throws
	 */
	public BigDecimal getBaseBondFee(LoanDetailDto LoanDetailDto,
			String baseCode){
		if(CimsConstant.BASE_BONDFEE_THISCREDITVALUE.equals(baseCode)){//合同金额
			return LoanDetailDto.getContractAmount();
		}else if(CimsConstant.BASE_BONDFEE_SYBJ.equals(baseCode)){ //放款金额
			return LoanDetailDto.getLoanAmount();
		}else if(CimsConstant.BASE_BONDFEE_SYBX.equals(baseCode)){ //放款金额
			return LoanDetailDto.getLoanAmount();
		}
		return new BigDecimal(0);
	}
	
	/**
	 * 根据服务类型获取 风险金计算基数 --贷款
	 * @Title getBaseRiskFee
	 * @Description TODO
	 * @param LoanDetailDto
	 * @param baseCode
	 * @return 
	 * BigDecimal 
	 * @author zhangmi
	 * @date 2016-8-16-下午2:54:15
	 * @update 
	 * @throws
	 */
	public BigDecimal getBaseRiskFee(LoanDetailDto LoanDetailDto,
			String baseCode){
		if(CimsConstant.BASE_RISKFEE_HT.equals(baseCode)){//合同金额
			return LoanDetailDto.getContractAmount();
		}else if(CimsConstant.BASE_RISKFEE_FK.equals(baseCode)){//放款金额
			return LoanDetailDto.getLoanAmount();
		}else if(CimsConstant.BASE_RISKFEE_SYBJ.equals(baseCode)){ //放款金额
			return LoanDetailDto.getLoanAmount();
		}else if(CimsConstant.BASE_RISKFEE_SYBX.equals(baseCode)){ //放款金额
			return LoanDetailDto.getLoanAmount();
		}else if(CimsConstant.BASE_RISKFEE_JGCREDIT.equals(baseCode)){ //放款金额
			return LoanDetailDto.getLoanAmount();
		}
		return new BigDecimal(0);
	}
	
}
